nvme-cli: update to 2.11
authorJohn Audia <[email protected]>
Sat, 15 Mar 2025 11:19:41 +0000 (07:19 -0400)
committerTianling Shen <[email protected]>
Tue, 25 Mar 2025 11:07:27 +0000 (19:07 +0800)
Bump to latest upstream release.

Removed upstreamed: 020-replace_uint16_t
Manually rebased: 010-gcc14.patch

To fix the following build error, added two commits from upstream:
020-nvme-print-add-fallback-for-.patch
021-pligins-netapp-add-include-of-libgen.h-for-basename.patch

Tested the resulting binary and it seems fine:
% nvme smart-log /dev/nvme0 | grep "temperature"
temperature : 42 °C (315 K)

Link to upstream issue: https://github.com/linux-nvme/nvme-cli/issues/2743

Build error:
../nvme-print.c: In function 'is_temperature_fahrenheit':
../nvme-print.c:805:19: error: 'LC_MEASUREMENT' undeclared (first use in this function)
  805 |         setlocale(LC_MEASUREMENT, "");
      |                   ^~~~~~~~~~~~~~
../nvme-print.c:805:19: note: each undeclared identifier is reported only once for each function it appears in

Build system: x86/64
Build-tested: x86/64
Run-tested: x86/64

Signed-off-by: John Audia <[email protected]>
utils/nvme-cli/Makefile
utils/nvme-cli/patches/010-gcc14.patch
utils/nvme-cli/patches/020-nvme-print-add-fallback-for-.patch [new file with mode: 0644]
utils/nvme-cli/patches/020-replace_uint16_t [deleted file]
utils/nvme-cli/patches/021-pligins-netapp-add-include-of-libgen.h-for-basename.patch [new file with mode: 0644]

index 7502943b1346862f2535450e3ea0114c9d95e2cc..90ad3983f390a5cbb50ae4d5f97f3a6491cea07b 100644 (file)
@@ -5,12 +5,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nvme-cli
-PKG_VERSION:=2.9.1
+PKG_VERSION:=2.11
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/linux-nvme/nvme-cli/archive/refs/tags/v$(PKG_VERSION)
-PKG_HASH:=4b61684a1d23de1d9d0abd3f273799c60256c0e2a2e68a790d7945183fe33874
+PKG_HASH:=5e4dc73dbb488c6b1e6ad1c78d0c62b624076fcb0c052bd9039674a1dbd6517b
 
 PKG_LICENSE:=GPL-2.0-or-later
 PKG_LICENSE_FILES:=LICENSE
index 63bc2415e347610bcb74e0e4a3a01bc8fdca9e03..5badc8b0730b238b28789088c3404ba19ae06dd4 100644 (file)
@@ -1,22 +1,5 @@
 --- a/plugins/virtium/virtium-nvme.c
 +++ b/plugins/virtium/virtium-nvme.c
-@@ -32,14 +32,14 @@ static char vt_default_log_file_name[256
- struct vtview_log_header {
-       char                            path[256];
-       char                            test_name[256];
--      long                            time_stamp;
-+      time_t                          time_stamp;
-       struct nvme_id_ctrl             raw_ctrl;
-       struct nvme_firmware_slot       raw_fw;
- };
- struct vtview_smart_log_entry {
-       char                    path[256];
--      long                    time_stamp;
-+      time_t                  time_stamp;
-       struct nvme_id_ns       raw_ns;
-       struct nvme_id_ctrl     raw_ctrl;
-       struct nvme_smart_log   raw_smart;
 @@ -127,7 +127,7 @@ static void vt_convert_smart_data_to_hum
  
        capacity = le64_to_cpu(smart->raw_ns.nsze) * lba;
diff --git a/utils/nvme-cli/patches/020-nvme-print-add-fallback-for-.patch b/utils/nvme-cli/patches/020-nvme-print-add-fallback-for-.patch
new file mode 100644 (file)
index 0000000..50df494
--- /dev/null
@@ -0,0 +1,31 @@
+From 9444ce03a27b8d423f8170cf75f56d48d8a0a659 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20N=C3=A9ri?= <[email protected]>
+Date: Mon, 11 Nov 2024 23:06:03 +0100
+Subject: [PATCH] nvme-print: add fallback for non-standard locale category
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+LC_MEASUREMENT is a GNU (libc) extension - fall back to LC_ALL if it's
+not defined.
+
+Fixes build with musl libc
+
+Signed-off-by: Daniel Néri <[email protected]>
+---
+ nvme-print.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/nvme-print.c
++++ b/nvme-print.c
+@@ -797,6 +797,10 @@ static bool is_fahrenheit_country(const
+       return false;
+ }
++#ifndef LC_MEASUREMENT
++#define LC_MEASUREMENT LC_ALL
++#endif
++
+ static bool is_temperature_fahrenheit(void)
+ {
+       const char *locale, *underscore;
diff --git a/utils/nvme-cli/patches/020-replace_uint16_t b/utils/nvme-cli/patches/020-replace_uint16_t
deleted file mode 100644 (file)
index 0e247f0..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-From 650070ad5d4a97fc87f9018743e3b566deba36c8 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 21 May 2024 14:09:32 -0700
-Subject: [PATCH] plugins/ssstc: Replace __uint16_t with uint16_t
-
-uint16_t is ISO defined and comes from stdint.h, makes it
-portable across glibc and musl on linux.
-
-Signed-off-by: Khem Raj <[email protected]>
----
- plugins/ssstc/ssstc-nvme.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/plugins/ssstc/ssstc-nvme.c
-+++ b/plugins/ssstc/ssstc-nvme.c
-@@ -64,9 +64,9 @@ void show_ssstc_add_smart_log_jsn(struct
-               unsigned int nsid, const char *devname)
- {
-       struct json_object *root, *entry_stats, *dev_stats, *multi;
--      __uint16_t wear_level_min = 0;
--      __uint16_t wear_level_max = 0;
--      __uint16_t wear_level_avg = 0;
-+      uint16_t wear_level_min = 0;
-+      uint16_t wear_level_max = 0;
-+      uint16_t wear_level_avg = 0;
-       uint64_t raw_val = 0;
-       root = json_create_object();
diff --git a/utils/nvme-cli/patches/021-pligins-netapp-add-include-of-libgen.h-for-basename.patch b/utils/nvme-cli/patches/021-pligins-netapp-add-include-of-libgen.h-for-basename.patch
new file mode 100644 (file)
index 0000000..016cdbc
--- /dev/null
@@ -0,0 +1,26 @@
+From ac4818952c872ba465a2d0f48634f9a79aae064f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20N=C3=A9ri?= <[email protected]>
+Date: Mon, 11 Nov 2024 22:34:57 +0100
+Subject: [PATCH] plugins/netapp: add include of libgen.h for basename(3)
+ prototype
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes build with musl libc.
+
+Signed-off-by: Daniel Néri <[email protected]>
+---
+ plugins/netapp/netapp-nvme.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/plugins/netapp/netapp-nvme.c
++++ b/plugins/netapp/netapp-nvme.c
+@@ -22,6 +22,7 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <string.h>
++#include <libgen.h>
+ #include "common.h"
+ #include "nvme.h"